package com.example.blueconn.data;

import androidx.annotation.NonNull;

/**
 * Created by zhudongao
 * Desc
 * Date 3/25/21
 */

public class LightData implements Cloneable{
    public float lightA1;
    public float lightA2;
    public float lightB1;
    public float lightB2;
    public float lightC1;
    public float lightC2;
    public float lightD1;
    public float lightD2;
    public float lightE1;
    public float lightE2;
    public float lightF1;
    public float lightF2;

    public boolean isHighMode = false;

    public float getLightByIndex(int i, boolean isFirst) {
        switch (i) {
            case 0:
                return isFirst ? lightA1 : lightA2;
            case 1:
                return isFirst ? lightB1 : lightB2;
            case 2:
                return isFirst ? lightC1 : lightC2;
            case 3:
                return isFirst ? lightD1 : lightD2;
            case 4:
                return isFirst ? lightE1 : lightE2;
            case 5:
                return isFirst ? lightF1 : lightF2;
            default:
                break;
        }
        return 0f;
    }

    @NonNull
    @Override
    public Object clone() throws CloneNotSupportedException {
        LightData data = null;
        try {
            data = (LightData) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return data;
    }

    @Override
    public String toString() {
        return "LightData{" +
                "lightA1=" + lightA1 +
                ", lightA2=" + lightA2 +
                ", lightB1=" + lightB1 +
                ", lightB2=" + lightB2 +
                ", lightC1=" + lightC1 +
                ", lightC2=" + lightC2 +
                ", lightD1=" + lightD1 +
                ", lightD2=" + lightD2 +
                ", lightE1=" + lightE1 +
                ", lightE2=" + lightE2 +
                ", lightF1=" + lightF1 +
                ", lightF2=" + lightF2 +
                ", isHighMode=" + isHighMode +
                '}';
    }
}
